﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Clandestine.Battle.Enemies
{
    public class EvilOscar : Enemy
    {

        public EvilOscar()
            : base("Evil Oscar", "evil_oscar.png")
        {
            base.HP = 300;
        }

        public override void TakeTurn(BattleController battle)
        {
            // Normally, a monster could choose between a basic attack, casting a spell etc. in here, then call that function.
            // For now, we'll just Attack!
            this.Attack(battle);
        }

        private void Attack(BattleController battle)
        {
            // Select target
            Random rand = new Random(System.DateTime.Now.Millisecond); // Not v. random >.>
            Combatant target = battle.Players[rand.Next(battle.Players.Count)];

            // Damage [Debug]
            int damage = 50;

            // Do attack
            battle.Queue.Add(delegate
            {
                MessageWindow.SetText("{0} attacks {1}", this.Name, target.Name);

                // Move forward in crappy battle anim
                int originalX = this.Sprite.X;
                Ticker.AddTimer((r, dR) => this.Sprite.X += (int)(dR * 100), 500);
                this.Sprite.X = originalX;

                target.TakeDamage(damage);
                MessageWindow.ClearText();
            });

        }
        
    }
}
